<template>
  <div class="App">
    <h1>项目实战code2</h1>
    <ul>
      <li v-for="(item,index) in arr" :key="index">{{item}}
        <button @click="delFn(index)">删除</button>
      </li>
    </ul>
    <button @click="addFn">生成</button>
  </div>
</template>

<script>
export default {
  data(){
    return{
     arr:[1,3,5,67,12,31,51,52]
    }
  },
  methods: {
    delFn(id){
      this.arr.splice(id,1)
    },
    addFn(){
      this.arr.push(Math.floor(Math.random(0,1) * 20))
    }
  }
}
</script>


<style scoped>

</style>
